rl-react-components 0.0.0-stage → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +92 -2
- package/dist/components/Button/Button.d.ts +8 -0
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/Card/Card.d.ts +28 -0
- package/dist/components/Card/index.d.ts +2 -0
- package/dist/components/Container/Container.d.ts +12 -0
- package/dist/components/Container/index.d.ts +2 -0
- package/dist/components/Icon/Icon.d.ts +36 -0
- package/dist/components/Icon/index.d.ts +2 -0
- package/dist/components/Markdown/Markdown.d.ts +11 -0
- package/dist/components/Markdown/index.d.ts +2 -0
- package/dist/components/MarkdownEditor/MarkdownEditor.d.ts +24 -0
- package/dist/components/MarkdownEditor/index.d.ts +2 -0
- package/dist/components/MatrixContainer/MatrixContainer.d.ts +54 -0
- package/dist/components/MatrixContainer/index.d.ts +4 -0
- package/dist/components/MatrixContainer/matrixConfig.d.ts +49 -0
- package/dist/components/OrbitalDots/OrbitalDots.d.ts +52 -0
- package/dist/components/OrbitalDots/index.d.ts +4 -0
- package/dist/components/OrbitalDots/orbitalDotsConfig.d.ts +54 -0
- package/dist/components/PageHero/PageHero.d.ts +10 -0
- package/dist/components/PageHero/index.d.ts +2 -0
- package/dist/components/PageTransition/PageTransition.d.ts +17 -0
- package/dist/components/PageTransition/index.d.ts +2 -0
- package/dist/components/Section/Section.d.ts +13 -0
- package/dist/components/Section/index.d.ts +2 -0
- package/dist/components/Select/Select.d.ts +11 -0
- package/dist/components/Select/index.d.ts +2 -0
- package/dist/components/ShimmerImage/ShimmerImage.d.ts +11 -0
- package/dist/components/ShimmerImage/index.d.ts +2 -0
- package/dist/components/SideNav/SideNav.d.ts +43 -0
- package/dist/components/SideNav/index.d.ts +2 -0
- package/dist/components/Tag/Tag.d.ts +24 -0
- package/dist/components/Tag/index.d.ts +2 -0
- package/dist/components/TagFilter/TagFilter.d.ts +10 -0
- package/dist/components/TagFilter/index.d.ts +2 -0
- package/dist/components/Text/Text.d.ts +37 -0
- package/dist/components/Text/index.d.ts +2 -0
- package/dist/components/TextArea/TextArea.d.ts +5 -0
- package/dist/components/TextArea/index.d.ts +2 -0
- package/dist/components/TextInput/TextInput.d.ts +7 -0
- package/dist/components/TextInput/index.d.ts +2 -0
- package/dist/components/Toast/ToastProvider.d.ts +13 -0
- package/dist/components/Toast/index.d.ts +2 -0
- package/dist/hooks/useDragReorder.d.ts +20 -0
- package/dist/hooks/useRotatingMessage.d.ts +10 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +1208 -0
- package/dist/styles.css +2 -0
- package/package.json +99 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Renato Lins
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,93 @@
|
|
|
1
|
-
#
|
|
1
|
+
# rl-react-components
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React 19 components and hooks built on one design system: layout, navigation, form fields, tags,
|
|
4
|
+
cards, Markdown, toasts and canvas effects. Dark and light modes, TypeScript types, and no text of
|
|
5
|
+
their own: every word a visitor reads comes in as a prop, in any language.
|
|
6
|
+
|
|
7
|
+
See every one working, in both modes, on the [demo page](https://react-shared-components.vercel.app).
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install rl-react-components
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
React and React DOM 19 are the only peer dependencies.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
Import the stylesheet once, at the root of the app, then use the components anywhere below it:
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import 'rl-react-components/styles.css';
|
|
23
|
+
import { Button, TextInput, ToastProvider, useToast } from 'rl-react-components';
|
|
24
|
+
|
|
25
|
+
function NewsletterForm() {
|
|
26
|
+
const { addToast } = useToast();
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<form
|
|
30
|
+
onSubmit={(event) => {
|
|
31
|
+
event.preventDefault();
|
|
32
|
+
addToast('You are subscribed.');
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
<TextInput label="Email" type="email" required />
|
|
36
|
+
<Button type="submit">Subscribe</Button>
|
|
37
|
+
</form>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default function App() {
|
|
42
|
+
return (
|
|
43
|
+
<ToastProvider dismissLabel="Dismiss notification">
|
|
44
|
+
<NewsletterForm />
|
|
45
|
+
</ToastProvider>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The components need no CSS reset: each sets the box model, margins and fonts it relies on.
|
|
51
|
+
|
|
52
|
+
## Light mode
|
|
53
|
+
|
|
54
|
+
Dark is the default. Put `data-theme="light"` on `<html>` to switch the page, or on any element to
|
|
55
|
+
switch just that part:
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
document.documentElement.dataset.theme = 'light';
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Every colour is a CSS custom property (`--color-accent`, `--color-bg` and so on), so an app can
|
|
62
|
+
override any of them in its own CSS.
|
|
63
|
+
|
|
64
|
+
## What is inside
|
|
65
|
+
|
|
66
|
+
| Group | Components and hooks |
|
|
67
|
+
| -------------- | ---------------------------------------------------- |
|
|
68
|
+
| Foundations | `Text`, `Icon` |
|
|
69
|
+
| Layout | `Container`, `Section`, `PageHero`, `PageTransition` |
|
|
70
|
+
| Navigation | `SideNav` |
|
|
71
|
+
| Forms | `Button`, `TextInput`, `TextArea`, `Select` |
|
|
72
|
+
| Tags | `Tag`, `TagFilter` |
|
|
73
|
+
| Content | `Card`, `Markdown`, `MarkdownEditor`, `ShimmerImage` |
|
|
74
|
+
| Feedback | `ToastProvider`, `useToast` |
|
|
75
|
+
| Canvas effects | `MatrixContainer`, `OrbitalDots` |
|
|
76
|
+
| Hooks | `useDragReorder`, `useRotatingMessage` |
|
|
77
|
+
|
|
78
|
+
## Documentation
|
|
79
|
+
|
|
80
|
+
- [Components](https://github.com/renatolinsdigital/react-shared-components/blob/master/docs/components.md):
|
|
81
|
+
what each one does, with a link to its props and examples.
|
|
82
|
+
- [Getting started](https://github.com/renatolinsdigital/react-shared-components/blob/master/docs/getting-started.md):
|
|
83
|
+
routers, server rendering and upgrading.
|
|
84
|
+
- [Theming](https://github.com/renatolinsdigital/react-shared-components/blob/master/docs/theming.md):
|
|
85
|
+
the colour tokens and how to override them.
|
|
86
|
+
- [Accessibility](https://github.com/renatolinsdigital/react-shared-components/blob/master/docs/accessibility.md):
|
|
87
|
+
what the components handle, and what the app supplies.
|
|
88
|
+
|
|
89
|
+
Questions and bug reports: [GitHub issues](https://github.com/renatolinsdigital/react-shared-components/issues).
|
|
90
|
+
|
|
91
|
+
## License
|
|
92
|
+
|
|
93
|
+
MIT
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
variant?: 'primary' | 'secondary' | 'ghost' | 'danger';
|
|
4
|
+
size?: 'small' | 'medium' | 'large';
|
|
5
|
+
fullWidth?: boolean;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export default function Button({ variant, size, fullWidth, children, className, ...props }: ButtonProps): React.JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface CardProps {
|
|
3
|
+
title: React.ReactNode;
|
|
4
|
+
/** A line or two under the title. */
|
|
5
|
+
description?: React.ReactNode;
|
|
6
|
+
/** Shown in an accent tile at the top. Decorative: the tile is hidden from screen readers. */
|
|
7
|
+
icon?: React.ReactNode;
|
|
8
|
+
/** A short label at the top, such as a category. */
|
|
9
|
+
eyebrow?: React.ReactNode;
|
|
10
|
+
/** Makes the whole card a link, with a hover lift, a glow that follows the pointer and an arrow. */
|
|
11
|
+
href?: string;
|
|
12
|
+
target?: string;
|
|
13
|
+
rel?: string;
|
|
14
|
+
/** Renders the title as a heading of this level instead of plain text. */
|
|
15
|
+
headingLevel?: 2 | 3 | 4 | 5 | 6;
|
|
16
|
+
/**
|
|
17
|
+
* The element or component to render. Default: 'a' with `href`, else 'div'. Pass a router's
|
|
18
|
+
* link component to navigate without a page load: it receives `href` and the rest.
|
|
19
|
+
*/
|
|
20
|
+
as?: React.ElementType;
|
|
21
|
+
/** Content under the description. Nothing interactive in a link card: links cannot nest. */
|
|
22
|
+
children?: React.ReactNode;
|
|
23
|
+
className?: string;
|
|
24
|
+
style?: React.CSSProperties;
|
|
25
|
+
id?: string;
|
|
26
|
+
}
|
|
27
|
+
/** A surface with an optional icon and eyebrow, a title and a description; a link with `href`. */
|
|
28
|
+
export default function Card({ title, description, icon, eyebrow, href, target, rel, headingLevel, as, children, className, style, id, }: CardProps): React.JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ContainerProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
/**
|
|
5
|
+
* The breakpoint whose width caps the container: `sm` 640px, `md` 768px, `lg` 1024px,
|
|
6
|
+
* `xl` 1280px, `xxl` 1600px.
|
|
7
|
+
*/
|
|
8
|
+
size?: 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
9
|
+
className?: string;
|
|
10
|
+
as?: React.ElementType;
|
|
11
|
+
}
|
|
12
|
+
export default function Container({ children, size, className, as: Tag, }: ContainerProps): React.JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
declare const PATHS: {
|
|
2
|
+
sun: import("react").JSX.Element;
|
|
3
|
+
moon: import("react").JSX.Element;
|
|
4
|
+
copy: import("react").JSX.Element;
|
|
5
|
+
check: import("react").JSX.Element;
|
|
6
|
+
arrowRight: import("react").JSX.Element;
|
|
7
|
+
arrowUpRight: import("react").JSX.Element;
|
|
8
|
+
code: import("react").JSX.Element;
|
|
9
|
+
book: import("react").JSX.Element;
|
|
10
|
+
layout: import("react").JSX.Element;
|
|
11
|
+
compass: import("react").JSX.Element;
|
|
12
|
+
input: import("react").JSX.Element;
|
|
13
|
+
tag: import("react").JSX.Element;
|
|
14
|
+
document: import("react").JSX.Element;
|
|
15
|
+
bell: import("react").JSX.Element;
|
|
16
|
+
sparkle: import("react").JSX.Element;
|
|
17
|
+
braces: import("react").JSX.Element;
|
|
18
|
+
type: import("react").JSX.Element;
|
|
19
|
+
};
|
|
20
|
+
/** The name of an icon in the set, such as `'bell'`. */
|
|
21
|
+
export type IconName = keyof typeof PATHS;
|
|
22
|
+
/** Every icon in the set, in a stable order: for a picker, or a page that shows them all. */
|
|
23
|
+
export declare const ICON_NAMES: IconName[];
|
|
24
|
+
export interface IconProps {
|
|
25
|
+
/** Which icon to draw. */
|
|
26
|
+
name: IconName;
|
|
27
|
+
/** Its width and height in pixels. Size it to the text beside it: 16 for a button's label. */
|
|
28
|
+
size?: number;
|
|
29
|
+
className?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A line icon in the colour of the text around it. It only decorates: it is hidden from screen
|
|
33
|
+
* readers, so the words beside it, or the `aria-label` of the control around it, give the name.
|
|
34
|
+
*/
|
|
35
|
+
export default function Icon({ name, size, className }: IconProps): import("react").JSX.Element;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface MarkdownProps {
|
|
2
|
+
/** Markdown source. GitHub-flavoured tables and ~~strikethrough~~ are supported. */
|
|
3
|
+
children: string;
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Renders Markdown as React elements. Raw HTML in the source is shown as text and unsafe
|
|
8
|
+
* link protocols such as `javascript:` are dropped, so content typed into the dashboard
|
|
9
|
+
* cannot inject scripts into the page.
|
|
10
|
+
*/
|
|
11
|
+
export default function Markdown({ children, className }: MarkdownProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type MarkdownAction = 'bold' | 'italic' | 'strikethrough' | 'heading1' | 'heading2' | 'heading3' | 'link' | 'image' | 'code' | 'bulletList' | 'numberedList' | 'quote' | 'codeBlock' | 'horizontalRule';
|
|
3
|
+
/** The editor's own text, so the caller can give it in the page's language. */
|
|
4
|
+
export interface MarkdownEditorLabels {
|
|
5
|
+
/** The tooltip and accessible name of each toolbar button. */
|
|
6
|
+
actions: Record<MarkdownAction, string>;
|
|
7
|
+
preview: string;
|
|
8
|
+
/** Inserted when a wrapping action (bold, link) runs with nothing selected. */
|
|
9
|
+
sampleText: string;
|
|
10
|
+
/**
|
|
11
|
+
* Read by screen readers with the text area, to say how to leave it, such as "Tab indents.
|
|
12
|
+
* Press Escape, then Tab, to leave the editor."
|
|
13
|
+
*/
|
|
14
|
+
tabHint?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface MarkdownEditorProps {
|
|
17
|
+
value: string;
|
|
18
|
+
onChange: (value: string) => void;
|
|
19
|
+
labels: MarkdownEditorLabels;
|
|
20
|
+
/** Shown above the editor and tied to its text area, which has no other name. */
|
|
21
|
+
label: string;
|
|
22
|
+
placeholder?: string;
|
|
23
|
+
}
|
|
24
|
+
export default function MarkdownEditor({ value, onChange, labels, label, placeholder, }: MarkdownEditorProps): React.JSX.Element;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { MatrixConfig } from './matrixConfig';
|
|
3
|
+
export interface MatrixContainerProps {
|
|
4
|
+
/** Content rendered above the matrix canvas */
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* Partial config override, merged over MATRIX_CONFIG at mount and then kept
|
|
8
|
+
* live: later changes apply to the running animation in place, without
|
|
9
|
+
* tearing down the canvas or the ResizeObserver. A key dropped from it falls
|
|
10
|
+
* back to its default. Start from MATRIX_PRESETS or MATRIX_THEME_CONFIG, or
|
|
11
|
+
* write one. Pass a stable object (defined outside the component or via
|
|
12
|
+
* useMemo) so unrelated parent re-renders do not trigger redundant merges.
|
|
13
|
+
*/
|
|
14
|
+
config?: Partial<MatrixConfig>;
|
|
15
|
+
/**
|
|
16
|
+
* CSS opacity applied to the canvas element itself (0 to 1).
|
|
17
|
+
* Multiplies with the per-glyph opacity values in config.
|
|
18
|
+
* Useful for dimming the entire effect without touching the config.
|
|
19
|
+
* Default: 1
|
|
20
|
+
*/
|
|
21
|
+
canvasOpacity?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Stops the rain on its current frame, and starts it again when false. Gives the app a way to
|
|
24
|
+
* offer a pause control. The rain also holds still while the reader prefers reduced motion.
|
|
25
|
+
* Default: false
|
|
26
|
+
*/
|
|
27
|
+
paused?: boolean;
|
|
28
|
+
/** Merged onto the wrapper element alongside the internal `.wrapper` class */
|
|
29
|
+
className?: string;
|
|
30
|
+
style?: React.CSSProperties;
|
|
31
|
+
id?: string;
|
|
32
|
+
/**
|
|
33
|
+
* HTML element to render as the wrapper.
|
|
34
|
+
* Use 'section', 'footer', 'aside', etc. to preserve semantic HTML.
|
|
35
|
+
* Default: 'div'
|
|
36
|
+
*/
|
|
37
|
+
as?: React.ElementType;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* MatrixContainer
|
|
41
|
+
*
|
|
42
|
+
* A wrapper element that renders the animated katakana matrix-rain canvas
|
|
43
|
+
* permanently in its background. All content passed as `children` is
|
|
44
|
+
* rendered on top of the canvas via a `position: relative; z-index: 1` layer.
|
|
45
|
+
*
|
|
46
|
+
* The canvas auto-sizes to fill the wrapper via ResizeObserver and cleans up
|
|
47
|
+
* on unmount (cancelAnimationFrame + ResizeObserver.disconnect). It is
|
|
48
|
+
* decorative, so it is hidden from assistive technology. While `paused` is set,
|
|
49
|
+
* or the reader prefers reduced motion, it draws one still frame instead.
|
|
50
|
+
*
|
|
51
|
+
* @see README.md for full algorithm and config documentation.
|
|
52
|
+
*/
|
|
53
|
+
declare const MatrixContainer: React.ForwardRefExoticComponent<MatrixContainerProps & React.RefAttributes<HTMLElement>>;
|
|
54
|
+
export default MatrixContainer;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Matrix rain effect: configuration
|
|
3
|
+
*
|
|
4
|
+
* All visual parameters for the falling-glyph animation. A `config` prop on
|
|
5
|
+
* <MatrixContainer> overrides any of them, and changes to it apply live.
|
|
6
|
+
* The defaults and the presets follow the standalone matrix-container repo.
|
|
7
|
+
*/
|
|
8
|
+
export interface MatrixConfig {
|
|
9
|
+
/** Font size in px, which is also the width and height of a grid cell */
|
|
10
|
+
fontSize: number;
|
|
11
|
+
/**
|
|
12
|
+
* Probability (0 to 1) that a column is active and has a falling stream.
|
|
13
|
+
* 0.25 means one column in four. Lower reads sparser, airier.
|
|
14
|
+
*/
|
|
15
|
+
columnDensity: number;
|
|
16
|
+
/** Number of rows in the fading tail behind the head glyph */
|
|
17
|
+
trailLength: number;
|
|
18
|
+
/**
|
|
19
|
+
* Milliseconds between each one-row advancement. Higher means a slower
|
|
20
|
+
* fall: at 50 ms and 20 px rows, a stream crosses 800 px in 2 s.
|
|
21
|
+
*/
|
|
22
|
+
tickMs: number;
|
|
23
|
+
/** The glyph colour as an RGB triple with no alpha, such as '0, 255, 0' */
|
|
24
|
+
color: string;
|
|
25
|
+
/** Opacity of the leading (brightest) glyph, 0 to 1 */
|
|
26
|
+
headOpacity: number;
|
|
27
|
+
/** Maximum opacity of the glyph immediately behind the head, 0 to 1 */
|
|
28
|
+
trailOpacityMax: number;
|
|
29
|
+
/** Glyph pool; one is picked at random for every cell drawn */
|
|
30
|
+
chars: string[];
|
|
31
|
+
}
|
|
32
|
+
export declare const MATRIX_CONFIG: MatrixConfig;
|
|
33
|
+
/** The names of the looks in `MATRIX_PRESETS`, each a kind of rain. */
|
|
34
|
+
export type MatrixPresetName = 'drizzle' | 'downpour' | 'storm';
|
|
35
|
+
/**
|
|
36
|
+
* Ready-made looks, merged over the defaults like any other `config`, and
|
|
37
|
+
* named for the rain they draw. Spread one and add to it:
|
|
38
|
+
* `{ ...MATRIX_PRESETS.drizzle, color: '0, 220, 255' }`. Each sets its own
|
|
39
|
+
* trail opacity, so the head stays the brightest glyph.
|
|
40
|
+
*/
|
|
41
|
+
export declare const MATRIX_PRESETS: Record<MatrixPresetName, Partial<MatrixConfig>>;
|
|
42
|
+
/**
|
|
43
|
+
* Mist: a quiet backdrop for each colour mode, for rain that sits behind text, for a
|
|
44
|
+
* caller that knows the active mode. Smaller, denser and much fainter than the
|
|
45
|
+
* defaults. Dark mode takes a lime softened toward green; light mode a deeper
|
|
46
|
+
* green, drawn stronger, because dark glyphs on a light page read much fainter
|
|
47
|
+
* than light ones on black at the same opacity.
|
|
48
|
+
*/
|
|
49
|
+
export declare const MATRIX_THEME_CONFIG: Record<'dark' | 'light', Partial<MatrixConfig>>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { OrbitalDotsConfig } from './orbitalDotsConfig';
|
|
3
|
+
export interface OrbitalDotsProps {
|
|
4
|
+
/** Content rendered above the canvas. */
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* Partial config override, merged with ORBITAL_DOTS_CONFIG at mount.
|
|
8
|
+
* Pass a stable reference (defined outside the component or via useMemo)
|
|
9
|
+
* to avoid unnecessary remounts when the parent re-renders.
|
|
10
|
+
*/
|
|
11
|
+
config?: Partial<OrbitalDotsConfig>;
|
|
12
|
+
/**
|
|
13
|
+
* CSS opacity on the <canvas> element (0 to 1).
|
|
14
|
+
* Useful for dimming the entire effect without touching the config.
|
|
15
|
+
* Default: 1
|
|
16
|
+
*/
|
|
17
|
+
canvasOpacity?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Stops the dots on their current frame, and starts them again when false. Gives the app a way
|
|
20
|
+
* to offer a pause control. The dots also hold still while the reader prefers reduced motion.
|
|
21
|
+
* Default: false
|
|
22
|
+
*/
|
|
23
|
+
paused?: boolean;
|
|
24
|
+
/** Merged onto the wrapper element alongside the internal `.wrapper` class. */
|
|
25
|
+
className?: string;
|
|
26
|
+
style?: React.CSSProperties;
|
|
27
|
+
id?: string;
|
|
28
|
+
/**
|
|
29
|
+
* HTML element to render as the wrapper.
|
|
30
|
+
* Default: 'div'
|
|
31
|
+
*/
|
|
32
|
+
as?: React.ElementType;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* OrbitalDots
|
|
36
|
+
*
|
|
37
|
+
* A wrapper element that renders an animated particle-network canvas in its
|
|
38
|
+
* background: drifting glowing dots, proximity-based connector lines, an
|
|
39
|
+
* optional dashed orbit ring, and floating code-syntax symbols.
|
|
40
|
+
*
|
|
41
|
+
* All content passed as `children` is rendered on top of the canvas via a
|
|
42
|
+
* `position: relative; z-index: 1` layer.
|
|
43
|
+
*
|
|
44
|
+
* The canvas auto-sizes to fill the wrapper via ResizeObserver and cleans up
|
|
45
|
+
* on unmount (cancelAnimationFrame + ResizeObserver.disconnect). It is
|
|
46
|
+
* decorative, so it is hidden from assistive technology. While `paused` is set,
|
|
47
|
+
* or the reader prefers reduced motion, it draws one still frame instead.
|
|
48
|
+
*
|
|
49
|
+
* @see README.md for full algorithm and config documentation.
|
|
50
|
+
*/
|
|
51
|
+
declare const OrbitalDots: React.ForwardRefExoticComponent<OrbitalDotsProps & React.RefAttributes<HTMLElement>>;
|
|
52
|
+
export default OrbitalDots;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default configuration for the OrbitalDots canvas effect.
|
|
3
|
+
*
|
|
4
|
+
* All values can be partially overridden via the `config` prop on <OrbitalDots>.
|
|
5
|
+
* Config is captured once at mount: remount the component to apply new values.
|
|
6
|
+
*/
|
|
7
|
+
export interface OrbitalDotsConfig {
|
|
8
|
+
/** Number of floating dot nodes. More dots = denser network. */
|
|
9
|
+
dotCount: number;
|
|
10
|
+
/** Maximum pixel distance between two dots before a connector line is drawn. */
|
|
11
|
+
maxLineDistance: number;
|
|
12
|
+
/** Minimum radius (px) of a dot. */
|
|
13
|
+
dotMinRadius: number;
|
|
14
|
+
/** Maximum radius (px) of a dot. */
|
|
15
|
+
dotMaxRadius: number;
|
|
16
|
+
/**
|
|
17
|
+
* Base velocity multiplier. Each dot's vx/vy is initialised as a random unit
|
|
18
|
+
* vector scaled by this value. Higher = faster drift.
|
|
19
|
+
*/
|
|
20
|
+
speed: number;
|
|
21
|
+
/** Maximum opacity of a connector line (at zero distance). Falls off linearly to 0. */
|
|
22
|
+
lineOpacity: number;
|
|
23
|
+
/** Opacity range for dots: each dot gets a random value in [dotOpacityMin, 1]. */
|
|
24
|
+
dotOpacityMin: number;
|
|
25
|
+
/** Shadow glow spread in pixels applied to all dots. */
|
|
26
|
+
glowBlur: number;
|
|
27
|
+
/** Whether to draw the dashed orbit ring in the canvas centre. */
|
|
28
|
+
showOrbitRing: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Radius of the orbit ring as a fraction of min(canvasWidth, canvasHeight).
|
|
31
|
+
* e.g. 0.28 = 28% of the shortest edge.
|
|
32
|
+
*/
|
|
33
|
+
orbitRingRadius: number;
|
|
34
|
+
/** Whether to render floating code symbols around the canvas. */
|
|
35
|
+
showSymbols: boolean;
|
|
36
|
+
/** Array of symbol strings to scatter around the canvas. */
|
|
37
|
+
symbols: string[];
|
|
38
|
+
/**
|
|
39
|
+
* Font size of the symbols, expressed as a fraction of min(width, height).
|
|
40
|
+
* e.g. 0.035 = 3.5% of the shortest canvas dimension.
|
|
41
|
+
*/
|
|
42
|
+
symbolFontScale: number;
|
|
43
|
+
/**
|
|
44
|
+
* Milliseconds between draw frames. Lower = smoother but heavier.
|
|
45
|
+
* Matches MatrixContainer's `tickMs` convention.
|
|
46
|
+
*/
|
|
47
|
+
tickMs: number;
|
|
48
|
+
/**
|
|
49
|
+
* Dot and line colour as an RGB triple string: `'R,G,B'`.
|
|
50
|
+
* Matches the MatrixContainer `color` convention.
|
|
51
|
+
*/
|
|
52
|
+
color: string;
|
|
53
|
+
}
|
|
54
|
+
export declare const ORBITAL_DOTS_CONFIG: OrbitalDotsConfig;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface PageHeroProps {
|
|
2
|
+
eyebrow: string;
|
|
3
|
+
title: string;
|
|
4
|
+
subtitle: string;
|
|
5
|
+
/** Number shown in the corner badge, such as the total number of posts. */
|
|
6
|
+
count: number;
|
|
7
|
+
countLabel: string;
|
|
8
|
+
}
|
|
9
|
+
/** Intro block at the top of a listing page: eyebrow, title, subtitle and a counter badge. */
|
|
10
|
+
export default function PageHero({ eyebrow, title, subtitle, count, countLabel }: PageHeroProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface PageTransitionProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
/**
|
|
5
|
+
* A change fades the content out and back in. Pass the current route's pathname to fade on
|
|
6
|
+
* every navigation; leave it out to fade in once, on mount.
|
|
7
|
+
*/
|
|
8
|
+
transitionKey?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Fade the content in when the component mounts. Default: true. Pass false on a
|
|
11
|
+
* server-rendered page: the first content then shows at once, in the server HTML too, and
|
|
12
|
+
* only a change of `transitionKey` fades.
|
|
13
|
+
*/
|
|
14
|
+
appear?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/** Fades its content in on mount, and again whenever `transitionKey` changes. */
|
|
17
|
+
export default function PageTransition({ children, transitionKey, appear, }: PageTransitionProps): React.JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SectionProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
variant?: 'dark' | 'elevated';
|
|
5
|
+
noPadding?: boolean;
|
|
6
|
+
className?: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
/** The id of the section's heading. A named section is a landmark a screen reader can jump to. */
|
|
9
|
+
'aria-labelledby'?: string;
|
|
10
|
+
/** The section's name, for a section with no heading to point at. */
|
|
11
|
+
'aria-label'?: string;
|
|
12
|
+
}
|
|
13
|
+
export default function Section({ children, variant, noPadding, className, id, 'aria-labelledby': ariaLabelledBy, 'aria-label': ariaLabel, }: SectionProps): React.JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SelectProps extends React.SelectHTMLAttributes<HTMLSelectElement> {
|
|
3
|
+
label?: string;
|
|
4
|
+
/** The text of the empty first option, such as "Select...". */
|
|
5
|
+
placeholder: string;
|
|
6
|
+
options: {
|
|
7
|
+
value: string;
|
|
8
|
+
label: string;
|
|
9
|
+
}[];
|
|
10
|
+
}
|
|
11
|
+
export default function Select({ label, placeholder, options, className, id, ...props }: SelectProps): React.JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ShimmerImageProps extends Omit<React.ImgHTMLAttributes<HTMLImageElement>, 'src' | 'alt' | 'onLoad'> {
|
|
3
|
+
src: string;
|
|
4
|
+
/** Describes the picture. Pass an empty string for a decorative one. */
|
|
5
|
+
alt: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* An `<img>` that fills its positioned parent, shows a shimmer while the file loads and fades the
|
|
9
|
+
* picture in once it has decoded. `className` lands on the `<img>`.
|
|
10
|
+
*/
|
|
11
|
+
export default function ShimmerImage({ src, alt, className, ...imageProps }: ShimmerImageProps): React.JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SideNavItem {
|
|
3
|
+
/** The link's text. */
|
|
4
|
+
label: React.ReactNode;
|
|
5
|
+
href: string;
|
|
6
|
+
/** Shown before the label. Decorative: hidden from screen readers. */
|
|
7
|
+
icon?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export interface SideNavGroup {
|
|
10
|
+
/** Shown above the group's links, and names them as a list for screen readers. */
|
|
11
|
+
title: React.ReactNode;
|
|
12
|
+
/** Shown before the title. Decorative: hidden from screen readers. */
|
|
13
|
+
icon?: React.ReactNode;
|
|
14
|
+
items: SideNavItem[];
|
|
15
|
+
}
|
|
16
|
+
export interface SideNavProps {
|
|
17
|
+
/** Names the navigation landmark for screen readers, such as "Documentation". */
|
|
18
|
+
label: string;
|
|
19
|
+
/** Links and groups of links, in order. A group is any entry with `items`. */
|
|
20
|
+
items: (SideNavItem | SideNavGroup)[];
|
|
21
|
+
/** The `href` of the link to highlight, such as the current path or `'#section'`. */
|
|
22
|
+
activeHref?: string | null;
|
|
23
|
+
/**
|
|
24
|
+
* What the highlighted link's `aria-current` says: `'page'` for links to pages, `'location'`
|
|
25
|
+
* for links to sections of one page.
|
|
26
|
+
*/
|
|
27
|
+
ariaCurrent?: 'page' | 'location';
|
|
28
|
+
/**
|
|
29
|
+
* Scrolls the nearest element around the menu that scrolls on its own, such as a sticky
|
|
30
|
+
* sidebar, so the current link stays in view as `activeHref` changes. It never scrolls the page.
|
|
31
|
+
*/
|
|
32
|
+
keepActiveInView?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* The link element or component. Default: 'a'. Pass a router's link component to navigate
|
|
35
|
+
* without a page load: it receives `href`, `className`, `aria-current`, `onClick` and children.
|
|
36
|
+
*/
|
|
37
|
+
as?: React.ElementType;
|
|
38
|
+
/** Called when a link is clicked, before it navigates, such as to close a drawer. */
|
|
39
|
+
onItemClick?: (item: SideNavItem, event: React.MouseEvent<HTMLAnchorElement>) => void;
|
|
40
|
+
className?: string;
|
|
41
|
+
}
|
|
42
|
+
/** A vertical menu of links, loose or in titled groups, each with an optional icon. */
|
|
43
|
+
export default function SideNav({ label, items, activeHref, ariaCurrent, keepActiveInView, as: Link, onItemClick, className, }: SideNavProps): React.JSX.Element;
|